home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmMain
- Caption = "How-To 1.6"
- ClientHeight = 2730
- ClientLeft = 1365
- ClientTop = 1650
- ClientWidth = 5115
- Height = 3135
- Icon = "1-6.frx":0000
- Left = 1305
- LinkTopic = "Form1"
- ScaleHeight = 2730
- ScaleWidth = 5115
- Top = 1305
- Width = 5235
- Begin VB.CommandButton cmdAction
- Caption = "Delete Key Value"
- Height = 345
- Index = 4
- Left = 2130
- TabIndex = 11
- Top = 2220
- Width = 1755
- End
- Begin VB.CommandButton cmdAction
- Caption = "Exit"
- Height = 1125
- Index = 5
- Left = 3990
- TabIndex = 10
- Top = 1440
- Width = 885
- End
- Begin VB.CommandButton cmdAction
- Caption = "Get Key Value"
- Height = 345
- Index = 2
- Left = 2130
- TabIndex = 9
- Top = 1440
- Width = 1755
- End
- Begin VB.CommandButton cmdAction
- Caption = "Set Key Value"
- Height = 345
- Index = 3
- Left = 2130
- TabIndex = 8
- Top = 1830
- Width = 1755
- End
- Begin VB.TextBox txtValue
- Height = 285
- Left = 1950
- TabIndex = 6
- Top = 1020
- Width = 2895
- End
- Begin VB.CommandButton cmdAction
- Caption = "Delete Registry Key"
- Height = 345
- Index = 1
- Left = 240
- TabIndex = 5
- Top = 1830
- Width = 1755
- End
- Begin VB.CommandButton cmdAction
- Caption = "Create Registry Key"
- Height = 345
- Index = 0
- Left = 240
- TabIndex = 4
- Top = 1440
- Width = 1755
- End
- Begin VB.TextBox txtSubKey
- Height = 285
- Left = 1950
- TabIndex = 1
- Text = "Authors"
- Top = 630
- Width = 2895
- End
- Begin VB.TextBox txtRegistryKey
- Height = 285
- Left = 1950
- TabIndex = 0
- Text = "\Software\WaiteGroupPress\VB-API-HowTo"
- Top = 240
- Width = 2895
- End
- Begin VB.Label lblCaption
- Caption = "Value contents"
- Height = 195
- Index = 2
- Left = 240
- TabIndex = 7
- Top = 1080
- Width = 1515
- End
- Begin VB.Label lblCaption
- Caption = "Value name"
- Height = 195
- Index = 1
- Left = 240
- TabIndex = 3
- Top = 690
- Width = 1515
- End
- Begin VB.Label lblCaption
- Caption = "Registry key"
- Height = 195
- Index = 0
- Left = 240
- TabIndex = 2
- Top = 300
- Width = 1515
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim RegistryAgent As clsRegistryAgent
- Private Sub cmdAction_Click(Index As Integer)
- ' Set the class properties using the contents
- ' of the text boxes.
- RegistryAgent.RegistryKey = txtRegistryKey.TEXT
- RegistryAgent.SubKey = txtSubKey.TEXT
- ' Set additional properties, and then invoke the
- ' required methods based ont he command button
- ' that was clicked by the user.
- Select Case Index
- Case 0 ' Create key
- RegistryAgent.CreateKey
-
- Case 1 ' Delete key
- RegistryAgent.DeleteKey
- txtSubKey.TEXT = ""
-
- Case 2 ' Get value
- RegistryAgent.GetValue
- txtValue.TEXT = RegistryAgent.KeyValue
-
- Case 3 ' Set value
- RegistryAgent.KeyValue = txtValue.TEXT
- RegistryAgent.SetValue
-
- Case 4 ' Delete value
- RegistryAgent.DeleteValue
- txtValue.TEXT = ""
- txtSubKey.TEXT = ""
-
- Case 5 ' Exit from program
- Unload frmMain
- End
-
- End Select
- End Sub
- Private Sub Form_Load()
- Dim tTempKey As String
- Set RegistryAgent = New clsRegistryAgent
- ' Use the class properties and methods to load
- ' some test data into the registry
- tTempKey = "\Software\WaiteGroupPress\VB-API-HowTo"
- RegistryAgent.RegistryKey = tTempKey
- RegistryAgent.SubKey = "Authors"
- RegistryAgent.KeyValue = "Noel and Eric"
- RegistryAgent.SetValue
- RegistryAgent.SubKey = "Visual Basic"
- RegistryAgent.KeyValue = "Version 4.0"
- RegistryAgent.SetValue
- RegistryAgent.SubKey = "Operating Systems"
- RegistryAgent.KeyValue = "32-Bit and 32s"
- RegistryAgent.SetValue
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- ' Remove the test data from the registry
- RegistryAgent.RegistryKey = "\Software\WaiteGroupPress"
- RegistryAgent.SubKey = "VB-API-HowTo"
- RegistryAgent.DeleteKey
- RegistryAgent.RegistryKey = "\Software"
- RegistryAgent.SubKey = "WaiteGroupPress"
- RegistryAgent.DeleteKey
- End Sub
-